package com.text.day2_1;

public class Fish extends Animal{       //继承关键字  extends
    private String local;   // 海，河，湖

    String nihao;

    public Fish() {
    }

    public Fish(String local) {
        this.local = local;
    }

    public Fish(String name, String type, String sex, int age, String local) {
        super(name, type, sex, age);
        this.local = local;
    }


    public void swimming() {
        System.out.println(this.getName() + "在" + this.local + "里游泳");
        this.setHungry(this.getHungry() + 1);
    }

    public String getLocal() {
        return local;
    }

    public void setLocal(String local) {
        this.local = local;
    }

    @Override    // 声明，写了这个表示重写父类的方法
    public String toString() {
        return "Fish{" +
                "local='" + local + '\'' +
                ", name='" + getName() + '\'' +
                ", type='" + getType() + '\'' +
                ", sex='" + getSex() + '\'' +
                ", age=" + getAge() +
                ", hungry=" + getHungry() +
                '}';
    }
}
